{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tic</th>\n",
       "      <th>date</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>open</th>\n",
       "      <th>close</th>\n",
       "      <th>adjcp</th>\n",
       "      <th>zopen</th>\n",
       "      <th>zhigh</th>\n",
       "      <th>zlow</th>\n",
       "      <th>...</th>\n",
       "      <th>normal_close</th>\n",
       "      <th>normal_high</th>\n",
       "      <th>normal_low</th>\n",
       "      <th>normal_EMA_12_close</th>\n",
       "      <th>normal_EMA_26_close</th>\n",
       "      <th>normal_EMA_10_close</th>\n",
       "      <th>normal_BB_mid</th>\n",
       "      <th>normal_BB_low</th>\n",
       "      <th>normal_BB_high</th>\n",
       "      <th>normal_MACD</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-04-29 23:59:59</td>\n",
       "      <td>147.488007</td>\n",
       "      <td>134.000000</td>\n",
       "      <td>134.444000</td>\n",
       "      <td>144.539993</td>\n",
       "      <td>144.539993</td>\n",
       "      <td>-0.069849</td>\n",
       "      <td>0.020396</td>\n",
       "      <td>-0.072921</td>\n",
       "      <td>...</td>\n",
       "      <td>0.014454</td>\n",
       "      <td>0.014749</td>\n",
       "      <td>0.013400</td>\n",
       "      <td>0.014454</td>\n",
       "      <td>0.014454</td>\n",
       "      <td>0.014454</td>\n",
       "      <td>0.000723</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-04-30 23:59:59</td>\n",
       "      <td>146.929993</td>\n",
       "      <td>134.050003</td>\n",
       "      <td>144.000000</td>\n",
       "      <td>139.000000</td>\n",
       "      <td>139.000000</td>\n",
       "      <td>0.035971</td>\n",
       "      <td>0.057050</td>\n",
       "      <td>-0.035611</td>\n",
       "      <td>...</td>\n",
       "      <td>0.013900</td>\n",
       "      <td>0.014693</td>\n",
       "      <td>0.013405</td>\n",
       "      <td>0.014369</td>\n",
       "      <td>0.014413</td>\n",
       "      <td>0.014353</td>\n",
       "      <td>0.001418</td>\n",
       "      <td>0.000634</td>\n",
       "      <td>0.002201</td>\n",
       "      <td>-0.000804</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-05-01 23:59:59</td>\n",
       "      <td>139.889999</td>\n",
       "      <td>107.720001</td>\n",
       "      <td>139.000000</td>\n",
       "      <td>116.989998</td>\n",
       "      <td>116.989998</td>\n",
       "      <td>0.188136</td>\n",
       "      <td>0.195743</td>\n",
       "      <td>-0.079238</td>\n",
       "      <td>...</td>\n",
       "      <td>0.011699</td>\n",
       "      <td>0.013989</td>\n",
       "      <td>0.010772</td>\n",
       "      <td>0.013958</td>\n",
       "      <td>0.014212</td>\n",
       "      <td>0.013871</td>\n",
       "      <td>0.002003</td>\n",
       "      <td>-0.000912</td>\n",
       "      <td>0.004917</td>\n",
       "      <td>-0.005274</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-05-02 23:59:59</td>\n",
       "      <td>125.599998</td>\n",
       "      <td>92.281898</td>\n",
       "      <td>116.379997</td>\n",
       "      <td>105.209999</td>\n",
       "      <td>105.209999</td>\n",
       "      <td>0.106169</td>\n",
       "      <td>0.193803</td>\n",
       "      <td>-0.122879</td>\n",
       "      <td>...</td>\n",
       "      <td>0.010521</td>\n",
       "      <td>0.012560</td>\n",
       "      <td>0.009228</td>\n",
       "      <td>0.013429</td>\n",
       "      <td>0.013939</td>\n",
       "      <td>0.013262</td>\n",
       "      <td>0.002529</td>\n",
       "      <td>-0.001169</td>\n",
       "      <td>0.006226</td>\n",
       "      <td>-0.013574</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-05-03 23:59:59</td>\n",
       "      <td>108.127998</td>\n",
       "      <td>79.099998</td>\n",
       "      <td>106.250000</td>\n",
       "      <td>97.750000</td>\n",
       "      <td>97.750000</td>\n",
       "      <td>0.086957</td>\n",
       "      <td>0.106169</td>\n",
       "      <td>-0.190793</td>\n",
       "      <td>...</td>\n",
       "      <td>0.009775</td>\n",
       "      <td>0.010813</td>\n",
       "      <td>0.007910</td>\n",
       "      <td>0.012867</td>\n",
       "      <td>0.013630</td>\n",
       "      <td>0.012628</td>\n",
       "      <td>0.003017</td>\n",
       "      <td>-0.001086</td>\n",
       "      <td>0.007121</td>\n",
       "      <td>-0.024980</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2387</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2019-11-11 23:59:59</td>\n",
       "      <td>9081.279281</td>\n",
       "      <td>8700.608787</td>\n",
       "      <td>9056.917701</td>\n",
       "      <td>8757.788542</td>\n",
       "      <td>8757.788542</td>\n",
       "      <td>0.034156</td>\n",
       "      <td>0.036937</td>\n",
       "      <td>-0.006529</td>\n",
       "      <td>...</td>\n",
       "      <td>0.875779</td>\n",
       "      <td>0.908128</td>\n",
       "      <td>0.870061</td>\n",
       "      <td>0.902080</td>\n",
       "      <td>0.892517</td>\n",
       "      <td>0.902191</td>\n",
       "      <td>0.900956</td>\n",
       "      <td>0.787289</td>\n",
       "      <td>1.014624</td>\n",
       "      <td>1.450464</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2388</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2019-11-12 23:59:59</td>\n",
       "      <td>8853.768178</td>\n",
       "      <td>8685.428143</td>\n",
       "      <td>8759.751901</td>\n",
       "      <td>8815.662539</td>\n",
       "      <td>8815.662539</td>\n",
       "      <td>-0.006342</td>\n",
       "      <td>0.004322</td>\n",
       "      <td>-0.014773</td>\n",
       "      <td>...</td>\n",
       "      <td>0.881566</td>\n",
       "      <td>0.885377</td>\n",
       "      <td>0.868543</td>\n",
       "      <td>0.898924</td>\n",
       "      <td>0.891706</td>\n",
       "      <td>0.898441</td>\n",
       "      <td>0.907461</td>\n",
       "      <td>0.817369</td>\n",
       "      <td>0.997554</td>\n",
       "      <td>1.317977</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2389</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2019-11-13 23:59:59</td>\n",
       "      <td>8836.841790</td>\n",
       "      <td>8761.651122</td>\n",
       "      <td>8812.033629</td>\n",
       "      <td>8808.262582</td>\n",
       "      <td>8808.262582</td>\n",
       "      <td>0.000428</td>\n",
       "      <td>0.003245</td>\n",
       "      <td>-0.005292</td>\n",
       "      <td>...</td>\n",
       "      <td>0.880826</td>\n",
       "      <td>0.883684</td>\n",
       "      <td>0.876165</td>\n",
       "      <td>0.896140</td>\n",
       "      <td>0.890900</td>\n",
       "      <td>0.895238</td>\n",
       "      <td>0.914035</td>\n",
       "      <td>0.860922</td>\n",
       "      <td>0.967148</td>\n",
       "      <td>1.173609</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2390</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2019-11-14 23:59:59</td>\n",
       "      <td>8826.943659</td>\n",
       "      <td>8692.551880</td>\n",
       "      <td>8811.936332</td>\n",
       "      <td>8708.095095</td>\n",
       "      <td>8708.095095</td>\n",
       "      <td>0.011925</td>\n",
       "      <td>0.013648</td>\n",
       "      <td>-0.001785</td>\n",
       "      <td>...</td>\n",
       "      <td>0.870810</td>\n",
       "      <td>0.882694</td>\n",
       "      <td>0.869255</td>\n",
       "      <td>0.892243</td>\n",
       "      <td>0.889412</td>\n",
       "      <td>0.890797</td>\n",
       "      <td>0.914272</td>\n",
       "      <td>0.862025</td>\n",
       "      <td>0.966519</td>\n",
       "      <td>1.011694</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2391</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2019-11-15 23:59:59</td>\n",
       "      <td>8730.873427</td>\n",
       "      <td>8484.844185</td>\n",
       "      <td>8705.708101</td>\n",
       "      <td>8491.992012</td>\n",
       "      <td>8491.992012</td>\n",
       "      <td>0.025167</td>\n",
       "      <td>0.028130</td>\n",
       "      <td>-0.000842</td>\n",
       "      <td>...</td>\n",
       "      <td>0.849199</td>\n",
       "      <td>0.873087</td>\n",
       "      <td>0.848484</td>\n",
       "      <td>0.885621</td>\n",
       "      <td>0.886433</td>\n",
       "      <td>0.883233</td>\n",
       "      <td>0.910507</td>\n",
       "      <td>0.851013</td>\n",
       "      <td>0.970001</td>\n",
       "      <td>0.812976</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2392 rows × 41 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      tic                 date         high          low         open  \\\n",
       "0     BTC  2013-04-29 23:59:59   147.488007   134.000000   134.444000   \n",
       "1     BTC  2013-04-30 23:59:59   146.929993   134.050003   144.000000   \n",
       "2     BTC  2013-05-01 23:59:59   139.889999   107.720001   139.000000   \n",
       "3     BTC  2013-05-02 23:59:59   125.599998    92.281898   116.379997   \n",
       "4     BTC  2013-05-03 23:59:59   108.127998    79.099998   106.250000   \n",
       "...   ...                  ...          ...          ...          ...   \n",
       "2387  BTC  2019-11-11 23:59:59  9081.279281  8700.608787  9056.917701   \n",
       "2388  BTC  2019-11-12 23:59:59  8853.768178  8685.428143  8759.751901   \n",
       "2389  BTC  2019-11-13 23:59:59  8836.841790  8761.651122  8812.033629   \n",
       "2390  BTC  2019-11-14 23:59:59  8826.943659  8692.551880  8811.936332   \n",
       "2391  BTC  2019-11-15 23:59:59  8730.873427  8484.844185  8705.708101   \n",
       "\n",
       "            close        adjcp     zopen     zhigh      zlow  ...  \\\n",
       "0      144.539993   144.539993 -0.069849  0.020396 -0.072921  ...   \n",
       "1      139.000000   139.000000  0.035971  0.057050 -0.035611  ...   \n",
       "2      116.989998   116.989998  0.188136  0.195743 -0.079238  ...   \n",
       "3      105.209999   105.209999  0.106169  0.193803 -0.122879  ...   \n",
       "4       97.750000    97.750000  0.086957  0.106169 -0.190793  ...   \n",
       "...           ...          ...       ...       ...       ...  ...   \n",
       "2387  8757.788542  8757.788542  0.034156  0.036937 -0.006529  ...   \n",
       "2388  8815.662539  8815.662539 -0.006342  0.004322 -0.014773  ...   \n",
       "2389  8808.262582  8808.262582  0.000428  0.003245 -0.005292  ...   \n",
       "2390  8708.095095  8708.095095  0.011925  0.013648 -0.001785  ...   \n",
       "2391  8491.992012  8491.992012  0.025167  0.028130 -0.000842  ...   \n",
       "\n",
       "      normal_close  normal_high  normal_low  normal_EMA_12_close  \\\n",
       "0         0.014454     0.014749    0.013400             0.014454   \n",
       "1         0.013900     0.014693    0.013405             0.014369   \n",
       "2         0.011699     0.013989    0.010772             0.013958   \n",
       "3         0.010521     0.012560    0.009228             0.013429   \n",
       "4         0.009775     0.010813    0.007910             0.012867   \n",
       "...            ...          ...         ...                  ...   \n",
       "2387      0.875779     0.908128    0.870061             0.902080   \n",
       "2388      0.881566     0.885377    0.868543             0.898924   \n",
       "2389      0.880826     0.883684    0.876165             0.896140   \n",
       "2390      0.870810     0.882694    0.869255             0.892243   \n",
       "2391      0.849199     0.873087    0.848484             0.885621   \n",
       "\n",
       "      normal_EMA_26_close  normal_EMA_10_close  normal_BB_mid  normal_BB_low  \\\n",
       "0                0.014454             0.014454       0.000723            NaN   \n",
       "1                0.014413             0.014353       0.001418       0.000634   \n",
       "2                0.014212             0.013871       0.002003      -0.000912   \n",
       "3                0.013939             0.013262       0.002529      -0.001169   \n",
       "4                0.013630             0.012628       0.003017      -0.001086   \n",
       "...                   ...                  ...            ...            ...   \n",
       "2387             0.892517             0.902191       0.900956       0.787289   \n",
       "2388             0.891706             0.898441       0.907461       0.817369   \n",
       "2389             0.890900             0.895238       0.914035       0.860922   \n",
       "2390             0.889412             0.890797       0.914272       0.862025   \n",
       "2391             0.886433             0.883233       0.910507       0.851013   \n",
       "\n",
       "      normal_BB_high  normal_MACD  \n",
       "0                NaN     0.000000  \n",
       "1           0.002201    -0.000804  \n",
       "2           0.004917    -0.005274  \n",
       "3           0.006226    -0.013574  \n",
       "4           0.007121    -0.024980  \n",
       "...              ...          ...  \n",
       "2387        1.014624     1.450464  \n",
       "2388        0.997554     1.317977  \n",
       "2389        0.967148     1.173609  \n",
       "2390        0.966519     1.011694  \n",
       "2391        0.970001     0.812976  \n",
       "\n",
       "[2392 rows x 41 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "df=pd.read_csv(\"/home/sunshuo/qml/TradeMaster-1/data/data/BTC_for_iRDPG/train.csv\",index_col=0)\n",
    "df\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>best_action</th>\n",
       "      <th>return</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>-5.539993</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>-22.010002</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>-11.779999</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1.0</td>\n",
       "      <td>-7.459999</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2387</th>\n",
       "      <td>1.0</td>\n",
       "      <td>-297.737515</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2388</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>57.873997</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2389</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>-7.399957</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2390</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>-100.167487</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2391</th>\n",
       "      <td>0.0</td>\n",
       "      <td>-216.103083</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2392 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      best_action      return\n",
       "0            -1.0    0.000000\n",
       "1            -1.0   -5.539993\n",
       "2            -1.0  -22.010002\n",
       "3            -1.0  -11.779999\n",
       "4             1.0   -7.459999\n",
       "...           ...         ...\n",
       "2387          1.0 -297.737515\n",
       "2388         -1.0   57.873997\n",
       "2389         -1.0   -7.399957\n",
       "2390         -1.0 -100.167487\n",
       "2391          0.0 -216.103083\n",
       "\n",
       "[2392 rows x 2 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[[\"best_action\",\"return\"]]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tic</th>\n",
       "      <th>date</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>open</th>\n",
       "      <th>close</th>\n",
       "      <th>adjcp</th>\n",
       "      <th>zopen</th>\n",
       "      <th>zhigh</th>\n",
       "      <th>zlow</th>\n",
       "      <th>...</th>\n",
       "      <th>normal_close</th>\n",
       "      <th>normal_high</th>\n",
       "      <th>normal_low</th>\n",
       "      <th>normal_EMA_12_close</th>\n",
       "      <th>normal_EMA_26_close</th>\n",
       "      <th>normal_EMA_10_close</th>\n",
       "      <th>normal_BB_mid</th>\n",
       "      <th>normal_BB_low</th>\n",
       "      <th>normal_BB_high</th>\n",
       "      <th>normal_MACD</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-04-30 23:59:59</td>\n",
       "      <td>146.929993</td>\n",
       "      <td>134.050003</td>\n",
       "      <td>144.000000</td>\n",
       "      <td>139.000000</td>\n",
       "      <td>139.000000</td>\n",
       "      <td>0.035971</td>\n",
       "      <td>0.057050</td>\n",
       "      <td>-0.035611</td>\n",
       "      <td>...</td>\n",
       "      <td>0.013900</td>\n",
       "      <td>0.014693</td>\n",
       "      <td>0.013405</td>\n",
       "      <td>0.014369</td>\n",
       "      <td>0.014413</td>\n",
       "      <td>0.014353</td>\n",
       "      <td>0.001418</td>\n",
       "      <td>0.000634</td>\n",
       "      <td>0.002201</td>\n",
       "      <td>-0.000804</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-05-01 23:59:59</td>\n",
       "      <td>139.889999</td>\n",
       "      <td>107.720001</td>\n",
       "      <td>139.000000</td>\n",
       "      <td>116.989998</td>\n",
       "      <td>116.989998</td>\n",
       "      <td>0.188136</td>\n",
       "      <td>0.195743</td>\n",
       "      <td>-0.079238</td>\n",
       "      <td>...</td>\n",
       "      <td>0.011699</td>\n",
       "      <td>0.013989</td>\n",
       "      <td>0.010772</td>\n",
       "      <td>0.013958</td>\n",
       "      <td>0.014212</td>\n",
       "      <td>0.013871</td>\n",
       "      <td>0.002003</td>\n",
       "      <td>-0.000912</td>\n",
       "      <td>0.004917</td>\n",
       "      <td>-0.005274</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-05-02 23:59:59</td>\n",
       "      <td>125.599998</td>\n",
       "      <td>92.281898</td>\n",
       "      <td>116.379997</td>\n",
       "      <td>105.209999</td>\n",
       "      <td>105.209999</td>\n",
       "      <td>0.106169</td>\n",
       "      <td>0.193803</td>\n",
       "      <td>-0.122879</td>\n",
       "      <td>...</td>\n",
       "      <td>0.010521</td>\n",
       "      <td>0.012560</td>\n",
       "      <td>0.009228</td>\n",
       "      <td>0.013429</td>\n",
       "      <td>0.013939</td>\n",
       "      <td>0.013262</td>\n",
       "      <td>0.002529</td>\n",
       "      <td>-0.001169</td>\n",
       "      <td>0.006226</td>\n",
       "      <td>-0.013574</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-05-03 23:59:59</td>\n",
       "      <td>108.127998</td>\n",
       "      <td>79.099998</td>\n",
       "      <td>106.250000</td>\n",
       "      <td>97.750000</td>\n",
       "      <td>97.750000</td>\n",
       "      <td>0.086957</td>\n",
       "      <td>0.106169</td>\n",
       "      <td>-0.190793</td>\n",
       "      <td>...</td>\n",
       "      <td>0.009775</td>\n",
       "      <td>0.010813</td>\n",
       "      <td>0.007910</td>\n",
       "      <td>0.012867</td>\n",
       "      <td>0.013630</td>\n",
       "      <td>0.012628</td>\n",
       "      <td>0.003017</td>\n",
       "      <td>-0.001086</td>\n",
       "      <td>0.007121</td>\n",
       "      <td>-0.024980</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-05-04 23:59:59</td>\n",
       "      <td>115.000000</td>\n",
       "      <td>92.500000</td>\n",
       "      <td>98.099998</td>\n",
       "      <td>112.500000</td>\n",
       "      <td>112.500000</td>\n",
       "      <td>-0.128000</td>\n",
       "      <td>0.022222</td>\n",
       "      <td>-0.177778</td>\n",
       "      <td>...</td>\n",
       "      <td>0.011250</td>\n",
       "      <td>0.011500</td>\n",
       "      <td>0.009250</td>\n",
       "      <td>0.012618</td>\n",
       "      <td>0.013454</td>\n",
       "      <td>0.012377</td>\n",
       "      <td>0.003580</td>\n",
       "      <td>-0.000151</td>\n",
       "      <td>0.007311</td>\n",
       "      <td>-0.035629</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-05-05 23:59:59</td>\n",
       "      <td>118.800003</td>\n",
       "      <td>107.142998</td>\n",
       "      <td>112.900002</td>\n",
       "      <td>115.910004</td>\n",
       "      <td>115.910004</td>\n",
       "      <td>-0.025968</td>\n",
       "      <td>0.024933</td>\n",
       "      <td>-0.075636</td>\n",
       "      <td>...</td>\n",
       "      <td>0.011591</td>\n",
       "      <td>0.011880</td>\n",
       "      <td>0.010714</td>\n",
       "      <td>0.012460</td>\n",
       "      <td>0.013316</td>\n",
       "      <td>0.012234</td>\n",
       "      <td>0.004159</td>\n",
       "      <td>0.000744</td>\n",
       "      <td>0.007575</td>\n",
       "      <td>-0.044707</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-05-06 23:59:59</td>\n",
       "      <td>124.663002</td>\n",
       "      <td>106.639999</td>\n",
       "      <td>115.980003</td>\n",
       "      <td>112.300003</td>\n",
       "      <td>112.300003</td>\n",
       "      <td>0.032769</td>\n",
       "      <td>0.110089</td>\n",
       "      <td>-0.050401</td>\n",
       "      <td>...</td>\n",
       "      <td>0.011230</td>\n",
       "      <td>0.012466</td>\n",
       "      <td>0.010664</td>\n",
       "      <td>0.012271</td>\n",
       "      <td>0.013161</td>\n",
       "      <td>0.012052</td>\n",
       "      <td>0.004721</td>\n",
       "      <td>0.001525</td>\n",
       "      <td>0.007917</td>\n",
       "      <td>-0.052767</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-05-07 23:59:59</td>\n",
       "      <td>113.444000</td>\n",
       "      <td>97.699997</td>\n",
       "      <td>112.250000</td>\n",
       "      <td>111.500000</td>\n",
       "      <td>111.500000</td>\n",
       "      <td>0.006726</td>\n",
       "      <td>0.017435</td>\n",
       "      <td>-0.123767</td>\n",
       "      <td>...</td>\n",
       "      <td>0.011150</td>\n",
       "      <td>0.011344</td>\n",
       "      <td>0.009770</td>\n",
       "      <td>0.012099</td>\n",
       "      <td>0.013012</td>\n",
       "      <td>0.011888</td>\n",
       "      <td>0.005278</td>\n",
       "      <td>0.002258</td>\n",
       "      <td>0.008299</td>\n",
       "      <td>-0.059788</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-05-08 23:59:59</td>\n",
       "      <td>115.779999</td>\n",
       "      <td>109.599998</td>\n",
       "      <td>109.599998</td>\n",
       "      <td>113.566002</td>\n",
       "      <td>113.566002</td>\n",
       "      <td>-0.034922</td>\n",
       "      <td>0.019495</td>\n",
       "      <td>-0.034922</td>\n",
       "      <td>...</td>\n",
       "      <td>0.011357</td>\n",
       "      <td>0.011578</td>\n",
       "      <td>0.010960</td>\n",
       "      <td>0.011984</td>\n",
       "      <td>0.012890</td>\n",
       "      <td>0.011791</td>\n",
       "      <td>0.005846</td>\n",
       "      <td>0.002989</td>\n",
       "      <td>0.008704</td>\n",
       "      <td>-0.065377</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-05-09 23:59:59</td>\n",
       "      <td>113.459999</td>\n",
       "      <td>109.260002</td>\n",
       "      <td>113.199997</td>\n",
       "      <td>112.669998</td>\n",
       "      <td>112.669998</td>\n",
       "      <td>0.004704</td>\n",
       "      <td>0.007012</td>\n",
       "      <td>-0.030265</td>\n",
       "      <td>...</td>\n",
       "      <td>0.011267</td>\n",
       "      <td>0.011346</td>\n",
       "      <td>0.010926</td>\n",
       "      <td>0.011874</td>\n",
       "      <td>0.012769</td>\n",
       "      <td>0.011696</td>\n",
       "      <td>0.006410</td>\n",
       "      <td>0.003686</td>\n",
       "      <td>0.009133</td>\n",
       "      <td>-0.069772</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-05-10 23:59:59</td>\n",
       "      <td>122.000000</td>\n",
       "      <td>111.551003</td>\n",
       "      <td>112.799004</td>\n",
       "      <td>117.199997</td>\n",
       "      <td>117.199997</td>\n",
       "      <td>-0.037551</td>\n",
       "      <td>0.040956</td>\n",
       "      <td>-0.048200</td>\n",
       "      <td>...</td>\n",
       "      <td>0.011720</td>\n",
       "      <td>0.012200</td>\n",
       "      <td>0.011155</td>\n",
       "      <td>0.011850</td>\n",
       "      <td>0.012692</td>\n",
       "      <td>0.011700</td>\n",
       "      <td>0.006996</td>\n",
       "      <td>0.004399</td>\n",
       "      <td>0.009592</td>\n",
       "      <td>-0.072385</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-05-11 23:59:59</td>\n",
       "      <td>118.679001</td>\n",
       "      <td>113.010002</td>\n",
       "      <td>117.699997</td>\n",
       "      <td>115.242996</td>\n",
       "      <td>115.242996</td>\n",
       "      <td>0.021320</td>\n",
       "      <td>0.029815</td>\n",
       "      <td>-0.019376</td>\n",
       "      <td>...</td>\n",
       "      <td>0.011524</td>\n",
       "      <td>0.011868</td>\n",
       "      <td>0.011301</td>\n",
       "      <td>0.011800</td>\n",
       "      <td>0.012605</td>\n",
       "      <td>0.011668</td>\n",
       "      <td>0.007572</td>\n",
       "      <td>0.005085</td>\n",
       "      <td>0.010059</td>\n",
       "      <td>-0.073862</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-05-12 23:59:59</td>\n",
       "      <td>117.448997</td>\n",
       "      <td>113.434998</td>\n",
       "      <td>115.639999</td>\n",
       "      <td>115.000000</td>\n",
       "      <td>115.000000</td>\n",
       "      <td>0.005565</td>\n",
       "      <td>0.021296</td>\n",
       "      <td>-0.013609</td>\n",
       "      <td>...</td>\n",
       "      <td>0.011500</td>\n",
       "      <td>0.011745</td>\n",
       "      <td>0.011343</td>\n",
       "      <td>0.011754</td>\n",
       "      <td>0.012523</td>\n",
       "      <td>0.011638</td>\n",
       "      <td>0.008147</td>\n",
       "      <td>0.005756</td>\n",
       "      <td>0.010538</td>\n",
       "      <td>-0.074422</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-05-13 23:59:59</td>\n",
       "      <td>118.698997</td>\n",
       "      <td>114.500000</td>\n",
       "      <td>114.820000</td>\n",
       "      <td>117.980003</td>\n",
       "      <td>117.980003</td>\n",
       "      <td>-0.026784</td>\n",
       "      <td>0.006094</td>\n",
       "      <td>-0.029497</td>\n",
       "      <td>...</td>\n",
       "      <td>0.011798</td>\n",
       "      <td>0.011870</td>\n",
       "      <td>0.011450</td>\n",
       "      <td>0.011761</td>\n",
       "      <td>0.012470</td>\n",
       "      <td>0.011667</td>\n",
       "      <td>0.008737</td>\n",
       "      <td>0.006431</td>\n",
       "      <td>0.011042</td>\n",
       "      <td>-0.073780</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>BTC</td>\n",
       "      <td>2013-05-14 23:59:59</td>\n",
       "      <td>119.800003</td>\n",
       "      <td>110.250000</td>\n",
       "      <td>117.980003</td>\n",
       "      <td>111.500000</td>\n",
       "      <td>111.500000</td>\n",
       "      <td>0.058117</td>\n",
       "      <td>0.074439</td>\n",
       "      <td>-0.011211</td>\n",
       "      <td>...</td>\n",
       "      <td>0.011150</td>\n",
       "      <td>0.011980</td>\n",
       "      <td>0.011025</td>\n",
       "      <td>0.011667</td>\n",
       "      <td>0.012372</td>\n",
       "      <td>0.011573</td>\n",
       "      <td>0.009294</td>\n",
       "      <td>0.007053</td>\n",
       "      <td>0.011536</td>\n",
       "      <td>-0.073186</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>15 rows × 41 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    tic                 date        high         low        open       close  \\\n",
       "1   BTC  2013-04-30 23:59:59  146.929993  134.050003  144.000000  139.000000   \n",
       "2   BTC  2013-05-01 23:59:59  139.889999  107.720001  139.000000  116.989998   \n",
       "3   BTC  2013-05-02 23:59:59  125.599998   92.281898  116.379997  105.209999   \n",
       "4   BTC  2013-05-03 23:59:59  108.127998   79.099998  106.250000   97.750000   \n",
       "5   BTC  2013-05-04 23:59:59  115.000000   92.500000   98.099998  112.500000   \n",
       "6   BTC  2013-05-05 23:59:59  118.800003  107.142998  112.900002  115.910004   \n",
       "7   BTC  2013-05-06 23:59:59  124.663002  106.639999  115.980003  112.300003   \n",
       "8   BTC  2013-05-07 23:59:59  113.444000   97.699997  112.250000  111.500000   \n",
       "9   BTC  2013-05-08 23:59:59  115.779999  109.599998  109.599998  113.566002   \n",
       "10  BTC  2013-05-09 23:59:59  113.459999  109.260002  113.199997  112.669998   \n",
       "11  BTC  2013-05-10 23:59:59  122.000000  111.551003  112.799004  117.199997   \n",
       "12  BTC  2013-05-11 23:59:59  118.679001  113.010002  117.699997  115.242996   \n",
       "13  BTC  2013-05-12 23:59:59  117.448997  113.434998  115.639999  115.000000   \n",
       "14  BTC  2013-05-13 23:59:59  118.698997  114.500000  114.820000  117.980003   \n",
       "15  BTC  2013-05-14 23:59:59  119.800003  110.250000  117.980003  111.500000   \n",
       "\n",
       "         adjcp     zopen     zhigh      zlow  ...  normal_close  normal_high  \\\n",
       "1   139.000000  0.035971  0.057050 -0.035611  ...      0.013900     0.014693   \n",
       "2   116.989998  0.188136  0.195743 -0.079238  ...      0.011699     0.013989   \n",
       "3   105.209999  0.106169  0.193803 -0.122879  ...      0.010521     0.012560   \n",
       "4    97.750000  0.086957  0.106169 -0.190793  ...      0.009775     0.010813   \n",
       "5   112.500000 -0.128000  0.022222 -0.177778  ...      0.011250     0.011500   \n",
       "6   115.910004 -0.025968  0.024933 -0.075636  ...      0.011591     0.011880   \n",
       "7   112.300003  0.032769  0.110089 -0.050401  ...      0.011230     0.012466   \n",
       "8   111.500000  0.006726  0.017435 -0.123767  ...      0.011150     0.011344   \n",
       "9   113.566002 -0.034922  0.019495 -0.034922  ...      0.011357     0.011578   \n",
       "10  112.669998  0.004704  0.007012 -0.030265  ...      0.011267     0.011346   \n",
       "11  117.199997 -0.037551  0.040956 -0.048200  ...      0.011720     0.012200   \n",
       "12  115.242996  0.021320  0.029815 -0.019376  ...      0.011524     0.011868   \n",
       "13  115.000000  0.005565  0.021296 -0.013609  ...      0.011500     0.011745   \n",
       "14  117.980003 -0.026784  0.006094 -0.029497  ...      0.011798     0.011870   \n",
       "15  111.500000  0.058117  0.074439 -0.011211  ...      0.011150     0.011980   \n",
       "\n",
       "    normal_low  normal_EMA_12_close  normal_EMA_26_close  normal_EMA_10_close  \\\n",
       "1     0.013405             0.014369             0.014413             0.014353   \n",
       "2     0.010772             0.013958             0.014212             0.013871   \n",
       "3     0.009228             0.013429             0.013939             0.013262   \n",
       "4     0.007910             0.012867             0.013630             0.012628   \n",
       "5     0.009250             0.012618             0.013454             0.012377   \n",
       "6     0.010714             0.012460             0.013316             0.012234   \n",
       "7     0.010664             0.012271             0.013161             0.012052   \n",
       "8     0.009770             0.012099             0.013012             0.011888   \n",
       "9     0.010960             0.011984             0.012890             0.011791   \n",
       "10    0.010926             0.011874             0.012769             0.011696   \n",
       "11    0.011155             0.011850             0.012692             0.011700   \n",
       "12    0.011301             0.011800             0.012605             0.011668   \n",
       "13    0.011343             0.011754             0.012523             0.011638   \n",
       "14    0.011450             0.011761             0.012470             0.011667   \n",
       "15    0.011025             0.011667             0.012372             0.011573   \n",
       "\n",
       "    normal_BB_mid  normal_BB_low  normal_BB_high  normal_MACD  \n",
       "1        0.001418       0.000634        0.002201    -0.000804  \n",
       "2        0.002003      -0.000912        0.004917    -0.005274  \n",
       "3        0.002529      -0.001169        0.006226    -0.013574  \n",
       "4        0.003017      -0.001086        0.007121    -0.024980  \n",
       "5        0.003580      -0.000151        0.007311    -0.035629  \n",
       "6        0.004159       0.000744        0.007575    -0.044707  \n",
       "7        0.004721       0.001525        0.007917    -0.052767  \n",
       "8        0.005278       0.002258        0.008299    -0.059788  \n",
       "9        0.005846       0.002989        0.008704    -0.065377  \n",
       "10       0.006410       0.003686        0.009133    -0.069772  \n",
       "11       0.006996       0.004399        0.009592    -0.072385  \n",
       "12       0.007572       0.005085        0.010059    -0.073862  \n",
       "13       0.008147       0.005756        0.010538    -0.074422  \n",
       "14       0.008737       0.006431        0.011042    -0.073780  \n",
       "15       0.009294       0.007053        0.011536    -0.073186  \n",
       "\n",
       "[15 rows x 41 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "state=df.iloc[1:16]\n",
    "state"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "111.5"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "state.close.iloc[-1]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "117.9800033569336"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "state.close.iloc[-2]\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.7.13 ('TradeMaster')",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.13"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "a1f97403911abd3f02553c8f2b0c54537fddc7efadd9f5d3e31784db6e40c347"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
